<template>
    <s-table ref="tableRef" :data="loadData" :scroll="{ x: 1200, }" :columns="columns" :pagination="false" class="mb-2">
        <template #bodyCell="{ column, record, index }">
            <template v-if="column.key === 'index'">
                {{ index + 1 }}
            </template>
        </template>
    </s-table>
</template>

<script setup name="invitebid">
import api from '@/api/contract/purchase/index'

const props = defineProps({
    proId: {
        type: String,
    },
})
const { proId } = toRefs(props)
const columns = [
    {
        title: '序号',
        dataIndex: 'index',
        key: 'index',
        align: "center",
    },

    {
        title: '项目编号',
        dataIndex: 'proCode',
        key: 'proCode',
        align: "center",
    },

    {
        title: '项目名称',
        dataIndex: 'proName',
        key: 'proName',
        align: "center",
    },
    // {
    //     title: '结算名称',
    //     dataIndex: 'settlementName',
    //     key: 'settlementName',
    //     align: "center",
    // },
    {
        title: '合作单位',
        dataIndex: 'cooperator',
        key: 'cooperator',
        align: "center",
    },

    {
        title: '结算金额',
        dataIndex: 'amount',
        key: 'amount',
        align: "center",
    },
    // {
    //     title: '项目情况',
    //     dataIndex: 'xminfo',
    //     key: 'xminfo',
    //     align: "center",
    // },
    {
        title: '申请人',
        dataIndex: 'createUserName',
        key: 'createUserName',
        align: "center",
    },
    // {
    //     title: '申请部门',
    //     dataIndex: 'appDepartment',
    //     key: 'appDepartment',
    //     align: "center",
    // },
    {
        title: '申请时间',
        dataIndex: 'createTime',
        key: 'createTime',
        align: "center",
    },
]


const tableRef = ref()
const loadData = (parameter) => {
    parameter.proId=props.proId
    return api.settlement({...parameter}).then((res) => {
        return res
    })
}



watch(
    () => props.proId,
    (newVal, oldVal) => {
        if (newVal) {
            nextTick(() => {
                tableRef.value.refresh(true)
            })
        }
    },
    { deep: true, immediate: true }
)

</script>
